﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mogre;

namespace WastedMechanics
{
    public class CharTaskIdle : CharTask
    {
        public Vector3 LookPoint;
        public Vector3 Position;

        public CharTaskIdle(Character chr, Vector3 lookpoint, Vector3 pos, string lbl = "") :
            base(chr, lbl)
        {
            LookPoint = lookpoint;
            Position = pos;
        }

        public CharTaskIdle(Character chr, Vector3 lp)
            : this(chr, lp, chr.Position)
        {
        }

        public override void Begin()
        {            
            Character.State.HaltOrder();
        }

        public override void Update()
        {            
            Character.State.HaltOrder();
            Character.State.StopAimingOrder();
            if (LookPoint != Vector3.ZERO)
                Character.TurnTo(LookPoint);            
        }
    }
}
